__author__ = 'longlong'
from socket import *
HOST = input('Please input your host:')  #注意主机名不能随便打，我小白。。。发现只有127.XX.XX.XX在本机可以正常使用
PORT = int(input('Please input your port:'))
ADDR = (HOST, PORT)
BUFSIZE = 1024
tcpCliSock = socket(AF_INET, SOCK_STREAM)
tcpCliSock.connect(ADDR)

while True:
    data = input('>')
    if not data:
        break
    tcpCliSock.send(data)
    data = tcpCliSock.recv(BUFSIZE)
    if not data:
        break
    print(data)
tcpCliSock.close()